package com.example.dayu521.sg_oss.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.example.dayu521.sg_oss.domain.OssIndex;
import com.example.dayu521.sg_oss.service.OssIndexService;
import com.example.dayu521.sg_oss.mapper.OssIndexMapper;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;

/**
* @author hasee
* @description 针对表【t_oss_index】的数据库操作Service实现
* @createDate 2023-06-16 13:24:12
*/
@Service
public class OssIndexServiceImpl extends ServiceImpl<OssIndexMapper, OssIndex>
    implements OssIndexService{

    @Override
    public List<String> list_obj_name(long base, long size) {
        Page<Map<String, Object>> page = new Page<>(base/size+1, size);
        var res = pageMaps(page,new QueryWrapper<OssIndex>()
                .select("obj_name")
                .eq("status",1)
        );
        return res.getRecords().stream().map(i->(String)i.get("obj_name")).collect(Collectors.toList());
    }
}




